﻿using System.Windows.Forms;

namespace MC.EventHandler.Install
{
    public partial class ConfigUI : Form
    {
        private readonly InstallationConfiguration _config;

        public ConfigUI(InstallationConfiguration config)
        {
            InitializeComponent();
            _config = config;

        }

        private void btnInstall_Click(object sender, System.EventArgs e)
        {
            if (_config.AnyRequiredValuesBlank())
            {
                MessageBox.Show("Make sure all fields are filled in.");
            }
            else
            {
                var installer = new InstallExecutor(_config);
                installer.Notification += installer_Notification;
                installer.Install();
            }
        }

        private static void installer_Notification(object sender, string message)
        {
            MessageBox.Show(message);
        }
    }
}
